const path =  require('path')
const fileUtils = require('../utils/file_utils')
module.exports = async (ctx,next)=>{
    const url = ctx.request.url
    let filePath = url.replace('/api','')
    filePath = '../data'+filePath+'.json'
    filePath = path.join(__dirname,filePath);
    const ret = await fileUtils.getFileJsonData(filePath)
    ctx.response.body = ret
    await next()
}